<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateInventoryHistory extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('inventory_history', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('inventory_id')->default(0)->comment('备件库存ID');
            $table->unsignedInteger('source_warehouse_id')->default(0)->comment('源仓库ID');
            $table->string('source_warehouse_type')->default('')->comment('源仓库类型(备件库、个人库)');
            $table->unsignedInteger('target_warehouse_id')->default(0)->comment('目标仓库ID');
            $table->string('target_warehouse_type')->default('')->comment('目标仓库类型(备件库、个人库)');
            $table->unsignedInteger('count')->default(0)->comment('数量');
            $table->string('action')->default('')->comment('动作');
            $table->string('type')->default('')->comment('类型(原因)');
            $table->string('description')->default('')->comment('说明信息');
            $table->unsignedInteger('create_user_id')->default(0)->comment('创建人ID');
            $table->integer('create_time')->nullable();
            $table->integer('update_time')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('inventory_history');
    }
}
